package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.service.INewsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/newsComment")
public class NewsCommentController {
    @Autowired
    private INewsCommentService newsCommentService;

    @PostMapping
    public void saveContent(Long userId, String content, Long newsId) {
        newsCommentService.save(userId, content, newsId);
    }

    @GetMapping("/{newsId}")
    public Object getComment(@PathVariable Long newsId) {
        return newsCommentService.selectByNewsId(newsId);
    }

}
